#include "../Card.h"
#include "../Logic.h"
#include "../Table.h"
#include <assert.h>
#include <vector>
#define EVALUATE_TABLE 1
using namespace std;
int main(void)
{
  Logic logic;
  /*
  Focus on 4-player tests... this is the main game. Add more coverage later if
  needed.
  */
  Table table(4);
  Deck* d = &table.activeCards;
  logic.setTable(&table);
  /* Get some cards to work with. */
  vector<Player*> players(100);
  int c = 0;
  Card ha(  hearts,   ace, c); ha.setOwner(players.at(c++));
  Card sa(  spades,   ace, c); sa.setOwner(players.at(c++));
  Card d2(diamonds,    _2, c); d2.setOwner(players.at(c++));
  Card s2(  spades,    _2, c); s2.setOwner(players.at(c++));
  Card c2(   clubs,    _2, c); c2.setOwner(players.at(c++));
  Card c3(   clubs,    _3, c); c3.setOwner(players.at(c++));
  Card h3(  hearts,    _3, c); h3.setOwner(players.at(c++));
  Card j0(   clubs, joker, c); j0.setOwner(players.at(c++));
  Card j1(   clubs, joker, c); j1.setOwner(players.at(c++));
  Card j2(   clubs, joker, c); j2.setOwner(players.at(c++));
  Card j3(   clubs, joker, c); j3.setOwner(players.at(c++));
  #if EVALUATE_TABLE
    vector<Player*> result;
    /* Test basic win. */
    d->add(&d2);
    d->add(&s2);
    d->add(&c2);
    d->add(&c3);
    result = logic.evaluateTable();
    assert(result.size() == 1);
    assert(result.at(0) == c3.getOwner());
    /* Test basic war. */
    /* Aces are low during peace. */
    /* Aces are high during war. */
    /* Make sure a war of aces makes all aces win. */
    /* In peace ace beats joker. */
    /* In war, ace beats joker. */
  #endif
  return 0;
}
